Skip to content

feat: reuse constrain variables across solve - #70

Merged
sbillinge merged 3 commits into
diffpy:mainfrom
ycexiao:keep-constraints
Nov 15, 2026
Merged

sbillinge merged 3 commits into
diffpy:mainfrom
ycexiao:keep-constraints

Conversation

@ycexiao

@ycexiao ycexiao commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR address?

Constrain variables are created in the recipe level per each solve. It is not removed so user can always access it.
Thus clean solve needs to clear the session completely to remove those variables.

This PR let solve to reuse the existing constrain variables if they have the same name, and remove all constrain equations after the optimization. No restart is needed to start a clean solve.

Constrain variables are refer to the ones used to build constrain equations not the parameters being constrained.

What should the reviewer(s) do?

@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (94f385a) to head (d9e7335).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   99.52%   99.54%   +0.01%     
==========================================
  Files           7        7              
  Lines         633      654      +21     
==========================================
+ Hits          630      651      +21     
  Misses          3        3              
Files with missing lines Coverage Δ
tests/test_refinement_session.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ycexiao
ycexiao marked this pull request as ready for review November 15, 2026 19:31
@ycexiao
ycexiao marked this pull request as draft November 15, 2026 19:36
@ycexiao
ycexiao marked this pull request as ready for review November 15, 2026 21:29
@ycexiao

ycexiao commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@sbillinge, it's ready for review.

@sbillinge
sbillinge merged commit 1a9421f into diffpy:main Nov 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants